package com.hxbd.gxsec_data.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
public class IndexController {

    @GetMapping(value = "/loginPage")
    public String loginPage(){
        return "login";
    }

    @PostMapping(value = "/faile")
    @ResponseBody
    public String faile(){
        return "失败了！！！";
    }


    @PostMapping(value = "/expireSesson")
    @ResponseBody
    public String expireSesson(){
        return "你的账号在其他地方登陆了";
    }

    @PostMapping(value = "/gotoIndex")
    public String index(){
        return "index";
    }


    @GetMapping(value = "/newmanager.html")
    public String newmanagerhtml(){
        return "newmanager";
    }

    @GetMapping(value = "/resourceManager.html")
    public String resourceManagerhtml(){
        return "resourceManager";
    }

    @GetMapping(value = "/updateNew.html{id}")
    public String updateNewhtml(@PathVariable Object id, Model model){
        model.addAttribute("id",id);
        return "updateNew";
    }

    @GetMapping(value = "/addNews.html")
    public String addNewshtml(){
        return "addNews";
    }

    @GetMapping(value = "/addReource.html")
    public String addReourcehtml(){
        return "addReource";
    }

    @GetMapping(value = "/updateResource.html")
    public String updateResourcehtml(){
        return "updateResource";
    }

    @GetMapping(value = "/previewNews.html")
    public String previewNews(@RequestParam String newsId, Model model){
        model.addAttribute("newsId",newsId);
        return "previewNews";
    }

}
